import base64
import os
from google import genai
from google.genai import types


def generate(message:str):
    """
    根据用户指令，生成非流式内容
    :param message:
    :param stream:
    :return:
    """
    client = genai.Client(
        api_key="AIzaSyA3qwmq1udzNxriHKxYpSbwu4Rx3PyB4LU"
    )

    model = "gemini-2.5-pro"
    contents = [
        types.Content(
            role="user",
            parts=[
                types.Part.from_text(text=message),
            ],
        ),
    ]
    tools = [
        #暂不使用工具
        # types.Tool(googleSearch=types.GoogleSearch()),
    ]
    generate_content_config = types.GenerateContentConfig(
        thinking_config = types.ThinkingConfig(
            thinking_budget=-1,
        ),
        tools=tools,
    )
    #流式响应
    # response_stream = client.models.generate_content_stream(
    #     model=model,
    #     contents=contents,
    #     config=generate_content_config,
    # )
    response = client.models.generate_content(
        model=model,
        contents=contents,
        config=generate_content_config,
    )
    full_response_text = response.text
    return full_response_text